<?php
/*   Description  of this file
*    Author king-of-war
*    Last Modified 2009-4-8
*    This class designed  for the news operation
*/
$root_path='./';
include_once $root_path.'smart.inc.php';
include_once $root_path.'head.php';
include_once $root_path.'class/page.php';
include_once $root_path.'/class/common.php';
/* init vars*/


$page=new page($root_path);
/*
 *  add count
 */
 $common=new common($root_path);

$common->count_add('pro');

/* get sorts
*/
$sorts=$common->get_sorts();
/*
*get products  sort_id is sort
*  $arr0 is page start 
*  $arr1 is page end 
*/
if(isset($_GET['sort'])){
$sort_id=$_GET['sort'];
/*
*  get pages
*/
if (isset($_GET['p'])) {
	$p = $_GET['p'];
} else {
	$p = 1;
}

$pages=$page->page_sort($p,$sort_id);
$arr[0]=$pages['start'];
$arr[1]=$pages['size'];



}else{
$sort_id='0';

/*
*  get pages
*/
if (isset($_GET['p'])) {
	$p = $_GET['p'];
} else {
	$p = 1;
}

 $pages=$page->page('products',$p);


$arr[0]=$pages['start'];
$arr[1]=$pages['size'];

}



$pros=$common->get_products($sort_id,$arr);


/*
 *  news_get($arr,1) $arr mean range ; 1means admin
 */

/*
*  set templates
*/
$temp_url=$temp_url;

$smarty->assign("pros",$pros);
$smarty->assign("pages",$pages);
$smarty->assign("sorts",$sorts);
$smarty->assign("url",$temp_url);
$smarty->display("pros.html");

include_once  "foot.php";

?>